﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Resources;
using System.Globalization;
using Microsoft.Win32;
using System.IO;

namespace UbuntuMigration
{
    public partial class FRMmain : Form
    {
        ResourceManager lang = new ResourceManager("UbuntuMigration.UbuntuMigration", Assembly.GetExecutingAssembly());

        public FRMmain()
        {
            InitializeComponent();
        }
        public List<User> users = new List<User>();
        private void FRMmain_Load(object sender, EventArgs e)
        {
            CultureInfo ci = CultureInfo.InstalledUICulture;
            //CultureInfo ci = new CultureInfo("nl-NL"); //For testing

            this.Text = lang.GetString("FRMmain_title",ci);
            LBLtitle.Text = lang.GetString("FRMmain_LBLtitle",ci);
            LBLdesc.Text = lang.GetString("FRMmain_LBLdesc",ci);
            BTNnext.Text = lang.GetString("BTNnext",ci);
            BTNcancel.Text = lang.GetString("BTNcancel",ci);


            RegistryKey profilelist = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList");
            String profiledir = Environment.ExpandEnvironmentVariables((String)profilelist.GetValue("ProfilesDirectory"));
            String[] dirs = Directory.GetDirectories(profiledir);
            foreach (String dir in dirs)
            {
                String dirname = Path.GetFileName(dir);
                if (dirname != "NetworkService" && dirname != "LocalService" && dirname != "Default User" && dirname != "All Users" && dirname != "Default" && dirname != "Public" && dirname != "UpdatusUser")
                {
                    users.Add(new User(dir));
                }
            }
            accountListView1.Users = users;
        }

        private void BTNcancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
